履歴: ソフトウェア/pukiwiki/bootstrap を使ってリニューアル
各行は、その日時に書かれた内容です。追加・削除は、1 つ前の版との行数の差です (全 6 版)。「差分」は比較する版、「基準」は比べる相手の版を選びます
| 日時 | タイトル | 文字数 | 追加 | 削除 | 内容 | 差分 | 基準 |
|---|---|---|---|---|---|---|---|
| 2016/6/13 15:23:02 | ソフトウェア/pukiwiki/bootstrap を使ってリニューアル 最新版 | 15,803 | +98 | -1 | 表示 | 差分 | — |
| 2015/2/19 15:09:12 | ソフトウェア/pukiwiki/bootstrap を使ってリニューアル | 13,438 | +31 | -5 | 表示 | 表示中 | 選択 |
| 2015/2/10 1:17:05 | ソフトウェア/pukiwiki/bootstrap を使ってリニューアル | 12,925 | +2 | -0 | 表示 | 差分 | 選択 |
| 2015/2/9 12:38:06 | ソフトウェア/pukiwiki/bootstrap を使ってリニューアル | 12,904 | +72 | -1 | 表示 | 差分 | 選択 |
| 2015/2/9 10:12:09 | ソフトウェア/pukiwiki/bootstrap を使ってリニューアル | 10,452 | +173 | -5 | 表示 | 差分 | 選択 |
| 2015/2/9 7:07:01 | ソフトウェア/pukiwiki/bootstrap を使ってリニューアル | 5,407 | — | — | 表示 | — | 基準 |
基準: ソフトウェア/pukiwiki/bootstrap を使ってリニューアル (2015/2/9 7:07:01) → 比較: ソフトウェア/pukiwiki/bootstrap を使ってリニューアル (2015/2/19 15:09:12)
@@ -2,6 +2,14 @@
#contents
+* 概要 [#vc3edbd8]
+
+これまでこのサイトでは、pukiwiki の標準に近いスキンを使っていたのですが、
+昨今の [[Google:モバイルファースト]] の流れに乗り、
+[[Google:Bootstrap]] を使ってリニューアルすることにしまた。
+
+2015-02-19 より、新しいスキンで運用を始めています。
+
* まずは開発用環境を一式整える [#n21779a4]
* php をインストール [#i6f4a7d3]
@@ -62,8 +70,8 @@
古い wiki のデータは EUC で保存されていたので、
これを UTF-8 に変換する必要がありました。
-古い wiki のディレクトリで以下のスクリプトを走らせて、
-do.sh というファイルを作成して、source コマンドでシェルに食べさせれば良いようでした。
+古い wiki のディレクトリで以下のスクリプトを走らせることで do.sh
+というファイルを作成して、source コマンドでシェルに食べさせればできました。
convert.php
LANG:php(linenumber)
@@ -75,7 +83,7 @@
function convert_dir(
$dir_name,
$callback, # function($src, $dest) { ... }
- $pattern = "/ (?!\.)([0-9A-F][0-9A-F]|_)*(\..*)?$/")
+ $pattern = "/^(?!\.)([0-9A-F][0-9A-F]|_)*(\..*)?$/")
{
$file_names = files_in_dir($dir_name, $pattern);
@@ -110,7 +118,7 @@
# 含んでいる場合があるため、それら以外の部分を変換する
function convert_filename($file_name)
{
- preg_match("/ ([ \.]*?)(\..*|)$/", $file_name, $matches); # 必ずマッチする
+ preg_match("/^([^\.]*?)(\..*|)$/", $file_name, $matches); # 必ずマッチする
$base_name = $matches[1];
$extention = $matches[2];
return implode("_", array_map("convert_code", explode("_", $base_name))) . $extention;
@@ -170,14 +178,15 @@
?>
LANG:console
- $ php convert.php > do.sh
+ $ php5 convert.php > do.sh
$ less do.sh
$ source do.sh
-あとは ????_utf8/* を新しい wiki の対応するフォルダにコピーすればOKでした。
+こうして変換した後、????_utf8/* を新しい wiki の対応するフォルダにコピーしました。
* スキンをいじる [#fc6de793]
+ LANG:console
$ ls skin/
index.html pukiwiki.css.php tdiary.css.php
keitai.skin.php pukiwiki.skin.php tdiary.skin.php
@@ -214,7 +223,8 @@
これとかどうかしら?
http://ironsummitmedia.github.io/startbootstrap-sb-admin-2/pages/index.html
-
+
+ LANG:console
$ cd skin/
$ wget https://github.com/IronSummitMedia/startbootstrap-sb-admin-2/archive/v1.0.5.zip
$ unzip v1.0.5.zip
@@ -229,13 +239,270 @@
http://localhost/pukiwiki/skin/sb-admin2.html で sb-admin2 のテーマを表示できるようになりました。
-* [#mfc597c4]
+* スキンの変更 [#mfc597c4]
pukiwiki.skin.php の
+ LANG:php
// ------------------------------------------------------------
// Output
以降に sb-admin2.html の内容を移していきます。
-** [#cd528615]
+** 不必要な設定をごっそり削除 [#cd528615]
+
+Output の前までを
+
+ LANG:php
+ <?php
+
+ // ------------------------------------------------------------
+ // Code start
+
+ // Prohibit direct access
+ if (! defined('UI_LANG')) die('UI_LANG is not set');
+ if (! isset($_LANG)) die('$_LANG is not set');
+ if (! defined('PKWK_READONLY')) die('PKWK_READONLY is not set');
+
+ $lang = & $_LANG['skin'];
+ $link = & $_LINK;
+ $image = & $_IMAGE['skin'];
+ $rw = ! PKWK_READONLY;
+
+まで削りました。
+
+** ヘッダー部分 [#d469b067]
+
+- DOCTYPE は html5
+- 文字セットは UTF-8 固定
+
+とするため、
+
+- http://dqn.sakusakutto.jp/2011/08/content-type-texthtml-charset-utf8.html
+- http://coliss.com/articles/build-websites/operation/work/generic-html5-template-by-sixrevisions.html
+- skin/pages/index.html
+
+を参考にしながら、以下のようにしました。
+
+ LANG:php
+ // ------------------------------------------------------------
+ // Output
+
+ // HTTP headers
+ pkwk_common_headers();
+ header('Cache-control: no-cache');
+ header('Pragma: no-cache');
+ header('Content-Type: text/html; charset=UTF-8');
+ ?>
+ <!DOCTYPE html>
+ <html lang="ja">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <!-- meta name="description" content="" -->
+ <meta name="author" content="<?php echo $modifier ?>">
+ <meta name="date" content="<?php echo $lastmodified ?>">
+ <?php if ($nofollow || ! $is_read) { ?> <meta name="robots" content="NOINDEX,NOFOLLOW" /><?php } ?>
+
+ <title><?php echo $title ?> - <?php echo $page_title ?></title>
+
+ <link rel="SHORTCUT ICON" href="<?php echo $image['favicon'] ?>" />
+ <link rel="alternate" type="application/rss+xml" title="RSS" href="<?php echo $link['rss'] ?>" /><?php // RSS auto-discovery ?>
+
+ <link href="skin/bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
+ <link href="skin/bower_components/metisMenu/dist/metisMenu.min.css" rel="stylesheet">
+ <link href="skin/dist/css/timeline.css" rel="stylesheet">
+ <link href="skin/dist/css/sb-admin-2.css" rel="stylesheet">
+ <link href="skin/bower_components/morrisjs/morris.css" rel="stylesheet">
+ <link href="skin/bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
+ <!--[if lt IE 9]>
+ <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
+ <![endif]-->
+
+ <?php echo $head_tag ?>
+ </head>
+
+これにともない、lib/html.php の pkwk_output_dtd は必要なくなっています。
+
+** $lastmodified について [#b12d8e08]
+
+フォーマットが良くないので、変更したい。
+
+ LANG:console
+ $ grep lastmodified lib/*
+ ...
+ lib/html.php: $lastmodified = $is_read ? format_date(get_filetime($_page)) .
+ $ less lib/html.php
+ $lastmodified = $is_read ? format_date(get_filetime($_page)) .
+ ' ' . get_pg_passage($_page, FALSE) : '';
+ $ less lib/func.php
+ function format_date($val, $paren = FALSE)
+ {
+ global $date_format, $time_format, $weeklabels;
+
+ $val += ZONETIME;
+
+ $date = date($date_format, $val) .
+ ' (' . $weeklabels[date('w', $val)] . ') ' .
+ date($time_format, $val);
+
+ return $paren ? '(' . $date . ')' : $date;
+ }
+ $ grep date_format *
+ pukiwiki.ini.php:$date_format = 'Y-m-d';
+ ...
+
+せっかく $date_format と $time_format を指定できるのに $weeklabels が必ず入ってしまう仕様。そして get_pg_passage も入っちゃう。
+
+似たような関数に get_date もあって、こっちも同じ。
+
+できれば出力を <time> タグで括って、datetime="" の属性に iso 8601 フォーマットで正確な日付を出力したい。そうしておけば後から Javascript などでいろいろできるはず(& new プラグインと被るけど・・・)。 [[Google:html5 time]]
+
+ LANG:php
+ function format_date_with_tag($val, $paren = FALSE)
+ {
+ return wrap_with_time_tag(format_date($val, $paren), $val);
+ }
+
+ function wrap_with_time_tag($display, $time = UTIME)
+ {
+ $datetime = date('c', $time);
+ return "<time datetime=\"$datetime\">$display</time>";
+ }
+
+として、
+
+ LANG:php
+ $lastmodified = $is_read ? format_date_with_tag(get_filetime($_page)) .
+ ' ' . get_pg_passage($_page, FALSE) : '';
+
+とすれば、上記の meta タグを
+
+ LANG:php
+ <meta name="date" content="<?php echo preg_replace('/.*\"(.*)\".*/', '\\1', $lastmodified) ?>">
+
+とすることで ISO 8601 形式の日付を入れられます。
+
+& new プラグインや # comment プラグインなどとも整合性がとれるようにいろいろいじる必要があるけれど・・・
+
+** navbar で囲む [#r1656382]
+
+ LANG:html
+ <body>
+ <div id="wrapper">
+
+ <!-- Navigation -->
+ <nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
+ <div class="navbar-header">
+ <!-- 左上のサイト名部分 -->
+ </div>
+ <ul class="nav navbar-top-links navbar-right">
+ <!-- 上部のバー -->
+ </ul>
+ <div class="navbar-default sidebar" role="navigation">
+ <!-- 左部のバー -->
+ </div>
+ </nav>
+
+ <div id="page-wrapper">
+ <!-- 本文 -->
+ </div>
+
+ </div>
+ </body>
+
+という構造なので、本文部分を上記で囲み、
+
+ LANG:php
+ <!-- 左部のバー -->
+ <?php if (arg_check('read') && exist_plugin_convert('menu')) { ?>
+ <div id="menubar"><?php echo do_plugin_convert('menu') ?></div>
+ <?php } ?>
+
+として、サイドメニューを左部に読み込むようにしました。
+
+** 編集メニューをトップバーに移す [#x6e0be42]
+
+ LANG:php
+ <ul class="nav navbar-top-links navbar-right">
+ <!-- 上部のバー -->
+ <?php include "navbar-top.php" ?>
+ </ul>
+
+として、
+
+ LANG:php
+ <li class="dropdown">
+ <a class="dropdown-toggle" data-toggle="dropdown" href="#">
+ <i class="fa fa-edit fa-fw"></i> <i class="fa fa-caret-down"></i>
+ </a>
+ <ul class="dropdown-menu">
+ <?php
+ function _navigator($key, $value = '', $javascript = ''){
+ $lang = & $GLOBALS['_LANG']['skin'];
+ $link = & $GLOBALS['_LINK'];
+ if (! isset($lang[$key])) { echo 'LANG NOT FOUND'; return FALSE; }
+ if (! isset($link[$key])) { echo 'LINK NOT FOUND'; return FALSE; }
+ if (! PKWK_ALLOW_JAVASCRIPT) $javascript = '';
+
+ echo '<a href="' . $link[$key] . '" ' . $javascript . '>' .
+ (($value === '') ? $lang[$key] : $value) .
+ '</a>';
+
+ return TRUE;
+ }
+ ?>
+
+ <?php if ($is_page) { ?>
+ <?php if ($rw) { ?>
+ <li><?php _navigator('edit') ?>
+ <?php if ($is_read && $function_freeze) { ?>
+ <li><?php (! $is_freeze) ? _navigator('freeze') : _navigator('unfreeze') ?>
+ <?php } ?>
+ <?php } ?>
+ <li><?php _navigator('diff') ?>
+ <?php if ($do_backup) { ?>
+ <li><?php _navigator('backup') ?>
+ <?php } ?>
+ <?php if ($rw && (bool)ini_get('file_uploads')) { ?>
+ <li><?php _navigator('upload') ?>
+ <?php } ?>
+ <li><?php _navigator('reload') ?>
+ <li class="divider"></li>
+ <?php } ?>
+
+ <?php if ($rw) { ?>
+ <li><?php _navigator('new') ?>
+ <?php } ?>
+ <li><?php _navigator('list') ?>
+ <?php if (arg_check('list')) { ?>
+ <li><?php _navigator('filelist') ?>
+ <?php } ?>
+ <li><?php _navigator('search') ?>
+ <li><?php _navigator('recent') ?>
+ <li><?php _navigator('help') ?>
+
+ <?php if ($trackback) { ?>
+ <li class="divider"></li>
+ <li><?php _navigator('trackback', $lang['trackback'] . '(' . tb_count($_page) . ')',
+ ($trackback_javascript == 1) ? 'onclick="OpenTrackback(this.href); return false"' : '') ?>
+ <?php } ?>
+ <?php if ($referer) { ?>
+ <li class="divider"></li>
+ <li><?php _navigator('refer') ?>
+ <?php } ?>
+ </ul>
+ </li>
+
+* paraedit.inc.php [#w5fcdd75]
+* highlight.js [#zce90f22]
+* math.inc.php [#n82749c6]
+* mathjax.inc.php [#b5021d3c]
+* recaptcha - Google [#r323f860]
+* lastmodified [#heff0364]
+* breadscrum [#peaf4b89]
+* 編集可能・不可能での表示・非表示 [#g80ae2b9]
+* heading にナビを追加 [#v7d66ad8]
+